package com.cstor.liang.mapper;

import com.cstor.liang.pojo.entity.UserMessage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * Created by Administrator on 2017/9/6.
 */
@Mapper
public interface UserMessageMapper extends GoMapper<UserMessage>{

    @Select(" UPDATE user_message SET have_read = 1 " +
            " WHERE id = #{userMessageId} AND user_id = #{userId} ")
    void setToReaded(@Param("userMessageId") Long userMessageId, @Param("userId") Long userId);

    @Select(" UPDATE user_message SET have_read = 1 WHERE user_id = #{userId} ")
    void setAllToReaded(Long userId);
}
